package com.qdu.servlet;

import com.qdu.model.Employee;
import com.qdu.service.impl.EmployeeServiceImpl;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.qdu.service.EmployeeService;

/**
 * 处理添加员工请求的Servlet
 *
 * @author Anna
 */
@WebServlet("/saes")
public class SearchAllEmployeeServlet extends HttpServlet {

    EmployeeService employeeService=new EmployeeServiceImpl();
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //调用业务逻辑 ，完成请求处理
        List<Employee> list=employeeService.findAllEmployees();
        //生成动态响应
        req.setAttribute("empList", list);
        req.getRequestDispatcher("/employee_list.jsp").forward(req, resp);
    }
}
